package tech.xiaozai.rbac.mapstruct;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import tech.xiaozai.rbac.bo.PermissionBO;
import tech.xiaozai.rbac.po.SysPermission;

import java.util.List;

/**
 * @author xiaozai
 * @version 1.0
 * @date 2020-09-21 09:47
 */

@Mapper
public interface PermissionMapStruct {

    PermissionMapStruct me = Mappers.getMapper(PermissionMapStruct.class);

    /**
     *  ...
     * @param permission
     * @return
     */
    @Mapping(target = "children",ignore = true)
    PermissionBO toBo(SysPermission permission);

    /**
     *   ...
     * @param permissionList
     * @return
     */
    List<PermissionBO> toBoList(List<SysPermission> permissionList);

    SysPermission toPo(PermissionBO permission);
}
